package com.pkuse.bjousystem.dto.student;

import org.apache.commons.lang3.StringUtils;

public class XueShengXinXiDTO {
    private String xm;
    private String xh;
    private String sfzh;
    private String yddh;
    private String dzzczh;
    private String byndxq;
    private String zymc;
    private String zyccmc;
    private String gzh;
    private String bdm;
    private String bmc;
    private String xjztmc;
    private String rxnd;
    private String rxxqmc;

    public XueShengXinXiDTO(String xm, String xh, String sfzh, String yddh, String dzzczh, String bynd, String byxqmc, String zymc, String zyccmc, String gzh, String bdm, String bmc, String xjztmc, String rxnd, String rxxqmc) {
        this.xm = xm;
        this.xh = xh;
        this.sfzh = sfzh;
        if (yddh != null && yddh.length() == 11) {
            this.yddh = maskString(yddh, 3, 7, '*');
        } else {
            this.yddh = yddh;
        }
        this.dzzczh = dzzczh;
        this.byndxq = StringUtils.trimToEmpty(bynd) + StringUtils.trimToEmpty(byxqmc);
        this.zymc = zymc;
        this.zyccmc = zyccmc;
        this.gzh = gzh;
        this.bdm = bdm;
        this.bmc = bmc;
        this.xjztmc = xjztmc;
        this.rxnd = rxnd;
        this.rxxqmc = rxxqmc;
    }

    public String getXm() {
        return xm;
    }

    public String getXh() {
        return xh;
    }

    public String getSfzh() {
        return sfzh;
    }

    public String getYddh() {
        return yddh;
    }

    private static String maskString(String strText, int start, int end, char maskChar) {
        if (strText == null || strText.equals(""))
            return "";

        if (start < 0)
            start = 0;

        if (end > strText.length())
            end = strText.length();

        int maskLength = end - start;

        if (maskLength == 0)
            return strText;

        StringBuilder sbMaskString = new StringBuilder(maskLength);

        for (int i = 0; i < maskLength; i++) {
            sbMaskString.append(maskChar);
        }

        return strText.substring(0, start)
                + sbMaskString.toString()
                + strText.substring(start + maskLength);
    }

    public String getDzzczh() {
        return dzzczh;
    }

    public String getByndxq() {
        return byndxq;
    }

    public String getZymc() {
        return zymc;
    }

    public String getZyccmc() {
        return zyccmc;
    }

    public String getGzh() {
        return gzh;
    }

    public String getBdm() {
        return bdm;
    }

    public String getBmc() {
        return bmc;
    }

    public String getXjztmc() {
        return xjztmc;
    }

    public String getRxnd() {
        return rxnd;
    }

    public String getRxxqmc() {
        return rxxqmc;
    }
}
